<template>
	<view class="uni_box home">
		<navbar title='遇到问题'>
		</navbar>
		<view class="content">
			<view class="list " :class="item.iszhan?'iszhan':''" v-for="(item,index) in list" :key="index" @click="listClick(item,index)">
				<view class="item">
					<text class="iname">{{item.title}}</text>
					<image class="icon_ck_sxia" v-if="!item.iszhan" style="transform: rotate(-90deg);" src="@/pages_admin/static/icon_ck_sxia.png" mode="" />
					<image class="icon_ck_sxia" v-else src="@/pages_admin/static/icon_ck_sxia.png" mode="" />
				</view>
				<view class="daan" v-if="item.content&&item.iszhan">
					答:{{item.content}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			this.getlist()
		},
		onShow() {
		},
		methods: {
			async getlist(){
				let res = await this.$u.api.getQuestionList({
					type:1
				});
				let data = res
				for(let i in data){
					data[i].iszhan = false
				}
				this.list = data
			},
			listClick(item,index){
				let list = this.list
				list[index].iszhan = !list[index].iszhan
				this.list = list
				console.log(list)
				this.$forceUpdate()
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.content{
		background-color: #fff;
		padding: 30rpx;
		min-height: 100vh;
		.list{
			margin-bottom: 30rpx;
			.item{
				background: #F5F5F5;
				border-radius: 20rpx;
				padding: 30rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				.iname{
					max-width: 80%;
					display: inline-block;
					font-weight: 500;
					font-size: 28rpx;
					color: #111111;
				}
				.icon_ck_sxia{
					width: 24rpx;
					height: 24rpx;
					margin-left: auto;
				}
			}
			.daan{
				background: #FFF8F5;
				border-radius:0 0 20rpx 20rpx;
				padding: 30rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				font-weight: 500;
				font-size: 28rpx;
				color: #FF773D;
			}
		}
		.iszhan{
			.item{
				border-radius:20rpx 20rpx 0 0 ;
			}
		}
	}
</style>
